f97396b1314cb7c3a55b3b223e0e8dd37e939682,jetty-io/src/test/java/org/eclipse/jetty/io/WriteFlusherTest.java,WriteFlusherTest,testCompleteBlocking,#,155
Before Change
public void testCompleteBlocking() throws Exception
{
FutureCallback callback = new FutureCallback();
_flusher.write(callback, BufferUtil.toBuffer("How "), BufferUtil.toBuffer("now "), BufferUtil.toBuffer("brown "), BufferUtil.toBuffer("cow!"));
assertFalse(callback.isDone());
assertFalse(callback.isCancelled());
After Change
@Test
public void testCompleteBlocking() throws Exception
{
ByteArrayEndPoint endPoint = new ByteArrayEndPoint(new byte[0], 10);
AtomicBoolean incompleteFlush = new AtomicBoolean();
WriteFlusher flusher = new WriteFlusher(endPoint)
{
@Override
protected void onIncompleteFlush()
{
incompleteFlush.set(true);
}
};
FutureCallback callback = new FutureCallback();
flusher.write(callback, BufferUtil.toBuffer("How now brown cow!"));
Assert.assertFalse(callback.isDone());
Assert.assertFalse(callback.isCancelled());
Assert.assertTrue(incompleteFlush.get());
try
{
callback.get(100, TimeUnit.MILLISECONDS);
Assert.fail();
}
catch (TimeoutException x)